package com.yanqu.road.entity.player;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.Objects;

public class UserInfo extends DataObject {
    /**
     * 用户编号
     */
    private long userId;
    /**
     * 用户唯一标识
     */
    private String openId = "";
    /**
     * 原始区服编号
     */
    private long originalServerId;
    /**
     * 客户端语言
     */
    private String language;
    /**
     * 注册时间
     */
    private long registerTime;
    /**
     * 装扮
     */
    private String decoration = "";
    /**
     * 最后一次登录的时间
     */
    private long lastLoginTime;
    /**
     * 性别
     */
    private short sex;
    /**
     * 昵称
     */
    private String nickName = "";
    /**
     * 联盟编号
     */
    private String unionUid;
    /**
     * 平台
     */
    private String platform;
    /**
     * 世界
     */
    private String world = "";
    /**
     * 洲
     */
    private String continent = "";
    /**
     * 国家
     */
    private String country = "";
    /**
     * 省份
     */
    private String province = "";
    /**
     * 城市
     */
    private String city = "";
    /**
     * 管理员标识
     */
    private boolean isAdmin;
    /**
     * 黑名单
     */
    private long blackListEndTime;
    /**
     * 禁言时间
     */
    private long forbiddenSpeakEndTime;
    /**
     * 玩家银两
     */
    private BigInteger silver = BigInteger.ZERO;
    /**
     * 门客经验
     */
    private BigInteger patronsExp = BigInteger.ZERO;
    /**
     * 赚钱速度
     */
    private BigInteger earnSpeed = BigInteger.ZERO;
    /**
     * 声望
     */
    private BigInteger prestige = BigInteger.ZERO;
    /**
     * 身份等级
     */
    private int titleId;
    /**
     * 手机平台 1：android 2：ios
     */
    private int phonePlatform = 1;
    /**
     * vip经验
     */
    private long vipExp;

    private BigInteger childEarnSpeed = BigInteger.ZERO;

    private int heartCount;               //祝福值

    private long lastHeartRecoverTime;    //上次祝福值恢复时间
    /**
     * 基础赚钱速度
     */
    private BigInteger baseEarnSpeed = BigInteger.ZERO;
    /**
     * 钱庄等级
     */
    private int houseLv;
    /**
     * 今日被蛊惑次数
     */
    private int todayBeHateTimes;
    /**
     * 系统解锁值
     */
    private BigInteger systemOpenValue = BigInteger.ZERO;
    /**
     * 门客数量
     */
    private int patronsCount;

    private String platformUserId = "";      //平台用户编号

    private String platformUserName = "";    //平台用户名称
    /**
     * 别名编号
     */
    private long userAliasId;

    private int hideVipAndAddress;

    private String appId = ""; //子包id
    private String childGameId = ""; // 子游戏id

    private int houseCreditLv; //钱庄荣誉等级

    private int bankSkinId; //钱庄皮肤，默认0


    /**
     * 是否官方指导员
     */
    private boolean isInstructor;
    /**
     * 庄园被协助次数
     */
    private int manorHelpCount;

    /**
     * 庄园上一次协助恢复时间
     */
    private long lastManorHelpRecoverTime;

    private String userMark = "";

    /**
     * 美女总亲密
     */
    private BigInteger totalIntimacy = BigInteger.ZERO;

    /**
     * 门客总赚钱
     */
    private BigInteger totalAbility = BigInteger.ZERO;

    private String badge = "";

    private String ipLocation;

    /**
     * 创角时间
     */
    private long createRoleTime;

    public UserInfo() {
        super();
        registerTime = System.currentTimeMillis() / 1000;
    }

    public long getOriginalServerId() {
        return originalServerId;
    }

    public void setOriginalServerId(long originalServerId) {
        if(this.originalServerId != originalServerId) {
            this.originalServerId = originalServerId;
            setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if(this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        if (!this.appId.equals(appId)) {
            this.appId = appId;
            setOp(DataStatus.Update);
        }
    }

    public String getChildGameId() {
        return childGameId;
    }

    public void setChildGameId(String childGameId) {
        if (!this.childGameId.equals(childGameId)) {
            this.childGameId = childGameId;
            setOp(DataStatus.Update);
        }
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        if(!Objects.equals(this.openId, openId)) {
            this.openId = openId;
            setUpdateOption();
        }
    }

    public long getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(long registerTime) {
        if (this.registerTime != registerTime) {
            this.registerTime = registerTime;
            setUpdateOption();
        }
    }

    public String getDecoration() {
        return decoration;
    }

    public void setDecoration(String decoration) {
        if (!Objects.equals(this.decoration, decoration)) {
            this.decoration = decoration;
            setUpdateOption();
        }
    }

    public String getUnionUid() {
        return unionUid;
    }

    public void setUnionUid(String unionUid) {
        if(!Objects.equals(this.unionUid, unionUid)) {
            this.unionUid = unionUid;
            setUpdateOption();
        }
    }

    public long getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(long lastLoginTime) {
        if (this.lastLoginTime != lastLoginTime) {
            this.lastLoginTime = lastLoginTime;
            setUpdateOption();
        }
    }


    public short getSex() {
        return sex;
    }

    public void setSex(short sex) {
        if(!Objects.equals(this.sex, sex)) {
            this.sex = sex;
            setUpdateOption();
        }
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        if(!Objects.equals(this.nickName, nickName)) {
            this.nickName = nickName;
            setUpdateOption();
        }
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        if (!Objects.equals(this.platform, platform)) {
            this.platform = platform;
            setUpdateOption();
        }
    }

    public boolean isAdmin() {
        return isAdmin;
    }

    public void setAdmin(boolean isAdmin) {
        if (this.isAdmin != isAdmin) {
            this.isAdmin = isAdmin;
            setUpdateOption();
        }
    }

    public long getBlackListEndTime() {
        return blackListEndTime;
    }

    public void setBlackListEndTime(long blackListEndTime) {
        if (this.blackListEndTime != blackListEndTime) {
            this.blackListEndTime = blackListEndTime;
            setUpdateOption();
        }
    }

    public BigInteger getSilver() {
        return silver;
    }

    public void setSilver(BigInteger silver) {
        if (!Objects.equals(this.silver, silver)) {
            this.silver = silver;
            setUpdateOption();
        }
    }

    public BigInteger getPatronsExp() {
        return patronsExp;
    }

    public void setPatronsExp(BigInteger patronsExp) {
        if(!Objects.equals(this.patronsExp, patronsExp)) {
            this.patronsExp = patronsExp;
            setUpdateOption();
        }
    }

    public BigInteger getEarnSpeed() {
        return earnSpeed;
    }

    public void setEarnSpeed(BigInteger earnSpeed) {
        if (!Objects.equals(this.earnSpeed, earnSpeed)) {
            this.earnSpeed = earnSpeed;
            setUpdateOption();
        }
    }

    public BigInteger getPrestige() {
        return prestige;
    }

    public void setPrestige(BigInteger prestige) {
        if(!Objects.equals(this.prestige, prestige)) {
            this.prestige = prestige;
            setUpdateOption();
        }
    }

    public long getForbiddenSpeakEndTime() {
        return forbiddenSpeakEndTime;
    }

    public void setForbiddenSpeakEndTime(long forbiddenSpeakEndTime) {
        if (forbiddenSpeakEndTime != this.forbiddenSpeakEndTime) {
            this.forbiddenSpeakEndTime = forbiddenSpeakEndTime;
            setUpdateOption();
        }
    }

    public String getContinent() {
        return continent;
    }

    public void setContinent(String continent) {
        if (!Objects.equals(continent, this.continent)) {
            this.continent = continent;
            setUpdateOption();
        }
    }

    public String getCountry() {
        if (country == null) {
            country = "中国";
        }
        return country;
    }

    public void setCountry(String country) {
        if (country == null) {
            return;
        }
        if (!Objects.equals(country, this.country)) {
            this.country = country;
            setUpdateOption();
        }
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        if (!Objects.equals(province, this.province)) {
            this.province = province;
            setUpdateOption();
        }
    }

    public String getCity() {
        if (city == null) {
            city =  "";
            setUpdateOption();
        }
        return city;
    }

    public void setCity(String city) {
        if (city == null) {
            return;
        }
        if (!Objects.equals(this.city, city)) {
            this.city = city;
            setUpdateOption();
        }
    }

    public int getTitleId() {
        return titleId;
    }

    public void setTitleId(int titleId) {
        if(this.titleId != titleId) {
            this.titleId = titleId;
            setUpdateOption();
        }
    }

    public int getPhonePlatform() {
        return phonePlatform;
    }

    public void setPhonePlatform(int phonePlatform) {
        if(this.phonePlatform != phonePlatform) {
            this.phonePlatform = phonePlatform;
            setUpdateOption();
        }
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        if (!StringUtils.isNullOrEmpty(language) && !language.equals(this.language)) {
            this.language = language;
            setUpdateOption();
        }
    }

    public long getVipExp() {
        return vipExp;
    }

    public void setVipExp(long vipExp) {
        if(this.vipExp != vipExp) {
            this.vipExp = vipExp;
            setUpdateOption();
        }
    }

    public BigInteger getChildEarnSpeed() {
        return childEarnSpeed;
    }

    public void setChildEarnSpeed(BigInteger childEarnSpeed) {
        if(!Objects.equals(this.childEarnSpeed, childEarnSpeed)) {
            this.childEarnSpeed = childEarnSpeed;
            setUpdateOption();
        }
    }

    public int getHeartCount() {
        return heartCount;
    }

    public void setHeartCount(int heartCount) {
        if(this.heartCount != heartCount) {
            this.heartCount = heartCount;
            setUpdateOption();
        }
    }

    public long getLastHeartRecoverTime() {
        return lastHeartRecoverTime;
    }

    public void setLastHeartRecoverTime(long lastHeartRecoverTime) {
        if(this.lastHeartRecoverTime != lastHeartRecoverTime) {
            this.lastHeartRecoverTime = lastHeartRecoverTime;
            setUpdateOption();
        }
    }

    public BigInteger getBaseEarnSpeed() {
        return baseEarnSpeed;
    }

    public void setBaseEarnSpeed(BigInteger baseEarnSpeed) {
        if(!Objects.equals(this.baseEarnSpeed, baseEarnSpeed)) {
            this.baseEarnSpeed = baseEarnSpeed;
            setUpdateOption();
        }
    }

    public int getHouseLv() {
        return houseLv;
    }

    public void setHouseLv(int houseLv) {
        if(this.houseLv != houseLv) {
            this.houseLv = houseLv;
            setUpdateOption();
        }
    }

    public int getTodayBeHateTimes() {
        return todayBeHateTimes;
    }

    public void setTodayBeHateTimes(int todayBeHateTimes) {
        if(this.todayBeHateTimes != todayBeHateTimes) {
            this.todayBeHateTimes = todayBeHateTimes;
            setUpdateOption();
        }
    }

    public BigInteger getSystemOpenValue() {
        return systemOpenValue;
    }

    public void setSystemOpenValue(BigInteger systemOpenValue) {
        if(!Objects.equals(this.systemOpenValue, systemOpenValue)) {
            this.systemOpenValue = systemOpenValue;
            setUpdateOption();
        }
    }

    public int getPatronsCount() {
        return patronsCount;
    }

    public void setPatronsCount(int patronsCount) {
        if(this.patronsCount != patronsCount) {
            this.patronsCount = patronsCount;
            setUpdateOption();
        }
    }

    public String getPlatformUserId() {
        return platformUserId;
    }

    public void setPlatformUserId(String platformUserId) {
        if(!Objects.equals(this.platformUserId, platformUserId)) {
            this.platformUserId = platformUserId;
            setUpdateOption();
        }
    }

    public String getPlatformUserName() {
        return platformUserName;
    }

    public void setPlatformUserName(String platformUserName) {
        if(!Objects.equals(this.platformUserName, platformUserName)) {
            this.platformUserName = platformUserName;
            setUpdateOption();
        }
    }

    public long getUserAliasId() {
        return userAliasId;
    }

    public void setUserAliasId(long userAliasId) {
        if(this.userAliasId != userAliasId) {
            this.userAliasId = userAliasId;
            setUpdateOption();
        }
    }

    public String getWorld() {
        return world;
    }

    public void setWorld(String world) {
        if(!Objects.equals(this.world, world)) {
            this.world = world;
            setUpdateOption();
        }
    }


    public int getHideVipAndAddress() {
        return hideVipAndAddress;
    }

    public void setHideVipAndAddress(int hideVipAndAddress) {
        if (this.hideVipAndAddress != hideVipAndAddress) {
            this.hideVipAndAddress = hideVipAndAddress;
            setUpdateOption();
        }
    }


    public int getHouseCreditLv() {
        return houseCreditLv;
    }

    public void setHouseCreditLv(int houseCreditLv) {
        if(this.houseCreditLv != houseCreditLv){
            this.houseCreditLv = houseCreditLv;
            setUpdateOption();
        }
    }

    public int getBankSkinId() {
        return bankSkinId;
    }

    public void setBankSkinId(int bankSkinId) {
        if(this.bankSkinId != bankSkinId){
            this.bankSkinId = bankSkinId;
            setUpdateOption();
        }
    }

    public boolean isInstructor() {
        return isInstructor;
    }

    public void setInstructor(boolean instructor) {
        if (this.isInstructor != instructor) {
            this.isInstructor = instructor;
            setUpdateOption();
        }
    }

    public int getManorHelpCount() {
        return manorHelpCount;
    }

    public void setManorHelpCount(int manorHelpCount) {
        if (this.manorHelpCount != manorHelpCount) {
            this.manorHelpCount = manorHelpCount;
            setUpdateOption();
        }
    }

    public long getLastManorHelpRecoverTime() {
        return lastManorHelpRecoverTime;
    }

    public void setLastManorHelpRecoverTime(long lastManorHelpRecoverTime) {
        if (this.lastManorHelpRecoverTime != lastManorHelpRecoverTime) {
            this.lastManorHelpRecoverTime = lastManorHelpRecoverTime;
            setUpdateOption();
        }
    }

    public String getUserMark() {
        return userMark;
    }

    public void setUserMark(String userMark) {
        if (!Objects.equals(this.userMark, userMark)) {
            this.userMark = userMark;
            setUpdateOption();
        }
    }

    public BigInteger getTotalIntimacy() {
        return totalIntimacy;
    }

    public void setTotalIntimacy(BigInteger totalIntimacy) {
        if (!Objects.equals(totalIntimacy, this.totalIntimacy)) {
            this.totalIntimacy = totalIntimacy;
            setUpdateOption();
        }
    }

    public BigInteger getTotalAbility() {
        return totalAbility;
    }

    public void setTotalAbility(BigInteger totalAbility) {
        if (!Objects.equals(totalAbility, this.totalAbility)) {
            this.totalAbility = totalAbility;
            setUpdateOption();
        }
    }

    public String getBadge() {
        return badge;
    }

    public void setBadge(String badge) {
        if (!Objects.equals(this.badge, badge)) {
            this.badge = badge;
            setUpdateOption();
        }
    }

    public String getIpLocation() {
        return ipLocation;
    }

    public void setIpLocation(String ipLocation) {
        if (!Objects.equals(this.ipLocation, ipLocation)) {
            this.ipLocation = ipLocation;
            setUpdateOption();
        }
    }
    public long getCreateRoleTime() {
        return createRoleTime;
    }

    public void setCreateRoleTime(long createRoleTime) {
        if(this.createRoleTime != createRoleTime) {
            this.createRoleTime = createRoleTime;
            setUpdateOption();
        }
    }
}
